import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
import Layout from '@/views/layout'
import Article from '@/views/article'
import Collect from '@/views/collect'
import Like from '@/views/like'
import User from '@/views/user'
import ArticleDetail from '@/views/article-detail'

const router = new VueRouter({
  // 一级路由
  routes: [
    {
      path: '/',
      redirect: '/layout',
    },
    {
      path: '/layout',
      component: Layout,
      // 二级
      children: [
        {
          path: '/',
          redirect: '/article',
        },
        {
          name: 'article',
          path: '/article',
          component: Article,
        },
        {
          name: 'collect',
          path: '/collect',
          component: Collect,
        },
        {
          name: 'like',
          path: '/like',
          component: Like,
        },
        {
          name: 'user',
          path: '/user',
          component: User,
        },
      ],
    },
    {
      path: '/detail/:id',
      component:ArticleDetail
    },
    
  ],
})

export default router
